<?php

namespace common\components;

use creocoder\nestedsets\NestedSetsQueryBehavior;

/**
 * Class ActiveQueryNS
 *
 * @method ActiveQuery roots()
 * @method ActiveQuery leaves()
 * @package common\components
 */
class ActiveQueryNS extends ActiveQuery
{

    /**
     * {@inheritdoc}
     */
    public function behaviors()
    {
        return [
            NestedSetsQueryBehavior::className(),
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function sort()
    {
        $this->orderBy('order_num DESC, lft ASC');
        return $this;
    }
}
